//封装购物车相关接口
import httpInstance from "@/utils/http";

// 加入购物车
export const insertCartAPI = ({ goodsId, count }) => {
    return httpInstance({
        url: 'cart/insert',
        method: 'POST',
        data: {
            goodsId,
            count
        }
    })
}


// 获取最新的购物车列表
export const findNewCartListAPI = () => {
    return httpInstance({
        url: '/cart/findNewCartList'
    })
}

// 删除购物车
export const delCartAPI = (goodsIds) => {
    return httpInstance({
        url: 'cart/delete',
        method: 'DELETE',
        data: {
            goodsIds
        }
    })
}

//合并购物车
export const mergeCartAPI = (data) =>{
    return httpInstance({
        url: 'cart/merge',
        method: 'POST',
        data
    })
}